package com.yaaha.config;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import springfox.documentation.builders.RequestHandlerSelectors;
import springfox.documentation.service.ApiInfo;
import springfox.documentation.service.Contact;
import springfox.documentation.spi.DocumentationType;
import springfox.documentation.spring.web.plugins.Docket;

import java.util.ArrayList;

@Configuration
public class SwaggerConfig {

    @Bean
    public Docket docket() {
        return new Docket(DocumentationType.SWAGGER_2)
                .apiInfo(this.getApiInfo())
                .select().apis(RequestHandlerSelectors.basePackage("com.yaaha.controller"))
                .build();
    }

    public ApiInfo getApiInfo() {
        return new ApiInfo("系统开放接口",
                "开发接口可任意调用",
                "v1.0",
                "www.dogedoge.com",
                new Contact("yaaha", "www.dogedoge.com", "yonghyun@yeah.net"),
                "Apache 2.0",
                "http://www.apache.org/licenses/LICENSE-2.0",
                new ArrayList<>());
    }
}
